package com.tjsinfo.tjsoa.messageImportant.action;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.tjsinfo.tjsoa.messageImportant.bo.IMessageImportantFileUploadBo;
import com.tjsinfo.tjsoa.messageImportant.bo.IMessageImportantMainBo;
import com.tjsinfo.tjsoa.messageImportant.vo.MessageImportantMain;

public class ReceiveMessageAction extends Action{
	private IMessageImportantMainBo importantMainBo;
	private IMessageImportantFileUploadBo importantFileUploadBo;

	public void setImportantFileUploadBo(
			IMessageImportantFileUploadBo importantFileUploadBo) {
		this.importantFileUploadBo = importantFileUploadBo;
	}

	public void setImportantMainBo(IMessageImportantMainBo importantMainBo) {
		this.importantMainBo = importantMainBo;
	}

	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		
		String id = request.getParameter("id");
		MessageImportantMain importantMain = importantMainBo.findById(id);
		request.setAttribute("importantMain", importantMain);
		
		List list = importantFileUploadBo.findByMainId(id);
		request.setAttribute("fileList", list);
		
		return mapping.findForward("ok");
	}
}
